@extends('home.layout.base')
<link rel="stylesheet" href="{{URL::asset('./css/hrmy/public.css')}}">
<link rel="stylesheet" href="{{URL::asset('./css/hrmy/index.css')}}">

@section('content')
<div class="mainHrContent" id="hrFootprint">
    <div class="storelistTitle" id="storelistTitle" v-cloak>
        <span class="storelistTitle_left">
            <span>
                <img src="{{URL::asset('./img/icon/home.png')}}">
            </span>
            <span><a href="{{route('home.index.index') }}">首页</a> >
                <a href="{{route('home.hrmy.hrIndex') }}">用户中心</a>
                > 浏览记录
            </span>
        </span>
        <span class="storelistTitle_right">
            <span>找不到合适的供应商？发个需求试试？</span>
            <button @click=" window.location.href = '{{ route('home.demand.demandAdd') }}'">免费发布需求</button>
        </span>
    </div>
    <div class="hrContent">
        @include('home.hrmy.menu')
        <div class="basicInfo" id="hrFootprints" v-cloak>
        <div class="basicInfo_title liulan" style="margin-bottom:0px">
                <p>
                  <span></span>
                  浏览记录
                </p>
                <div>
                  <div v-if="!del" @click="del=true">
                    <button>
                        <a href="javascript:void(0)">编辑</a>
                    </button>
                  </div>
                  <div v-if="del">
                    <button @click="delSure">
                        <a href="javascript:void(0)">删除</a>
                    </button>
                    <button @click="del=false">
                        <a href="javascript:void(0)">取消</a>
                    </button>
                  </div>
                </div>
            </div>
            <div class="footprintMian" v-for="(item,index) in listData">
                <!-- 供应商 -->
                <div class="footprint_store footchoose" v-if="item.type==1">
                    <el-checkbox v-if="del" v-model="item.check"></el-checkbox>
                    <div>
                    <img :src="item.store.logo" class="img">
                    <div class="box">
                        <p class="footprint_title">
                            <span class="footprint_name">@{{item.store.store_name}}
                                <img v-if="item.store.quality==2" src="{{URL::asset('./img/icon/storeColloct.png')}}">
                                <img v-if="item.store.hot==2" src="{{URL::asset('./img/icon/storeHot.png')}}">
                            </span>
                            <span class="browseTime"> 浏览于<span>
                                    @{{item.created_at}}
                                </span></span>
                        </p>
                        <p class="footprint_1">
                            <span>
                                {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                <span style="margin-right: 3px;">浏览量</span>
                                @{{item.store.view}}
                            </span>
                            <span>
                                {{--<img src="{{URL::asset('./img/icon/storeListTel.png')}}">--}}
                                <span style="margin-right: 3px;">来电咨询</span>
                                @{{item.store.call}}
                            </span>
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/storeListNote.png')}}">--}}
                                {{--@{{item.store.service}}--}}
                            {{--</span>--}}

                            <span>
                                {{--<img src="{{URL::asset('./img/icon/storeListZan.png')}}">--}}
                                {{--@{{item.store.praise}}--}}
                                <span style="margin-right: 3px;">好评</span>
                                    @{{item.store.credit}}%
                            </span>
                        </p>
                        <p>
                            @{{item.store.service_scope}} </p>
                    </div>
                    <button class="box-btn" @click=" window.location.href = '{{ route('home.store.store') }}?id='+item.store.id">
                        查看详情
                    </button>
                    </div>
                    
                </div>
                <!-- 产品 -->
                <div class="footprint_goods footchoose" v-if="item.type==3">
                  <el-checkbox v-if="del" v-model="item.check" @change="changeCheck(item,item.check)"></el-checkbox>
                    <div>
                    <img :src="item.goods.thumb" class="img">
                    <div class="box">
                        <p class="footprint_title">
                            <span class="footprint_name">@{{item.goods.title}}
                            </span>
                            <span class="browseTime"> 浏览于<span>
                                    @{{item.created_at}}
                                </span></span>
                        </p>
                        <p class="footprint_goodsMes">
                            @{{item.goods.description}}
                        </p>
                        <p class="footprint_goodsFooter">
                            <span v-if="item.goods.type!=3">
                                    <span style="margin-right: 3px;color: red;">价格</span>
                                    <span style="color: red;" v-if="item.goods.price!=0.00">￥@{{item.goods.price}}</span>
                                    <span style="color: red;" v-else>免费</span>
                                </span>
                            <span v-else>
                                    <span style="margin-right: 3px;color: red;">价格</span>
                                    <span style="color: red;" v-if="item.goods.price!=0.00">@{{item.goods.price}} 积分</span>
                                    <span style="color: red;" v-else>免费</span>
                                </span>
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                <span style="margin-right: 3px;">成交量</span>
                                    @{{item.goods.salenum}}
                                </span>
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                <span style="margin-right: 3px;">浏览量</span>
                                    @{{item.goods.view}}
                                </span>
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                <span style="margin-right: 3px;">好评</span>
                                    @{{item.goods.credit}}%
                                </span>
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                {{--@{{item.goods.salenum}}--}}
                            {{--</span>--}}
                            {{--<a v-if="item.goods.type!=3">--}}
                                {{--<span v-if="item.goods.price!=0.00">￥@{{item.goods.price}}</span>--}}
                                {{--<span v-else>免费</span>--}}
                            {{--</a>--}}
                            {{--<a v-else>--}}
                                {{--<span v-if="item.goods.price!=0.00">@{{item.goods.price}} 积分</span>--}}
                                {{--<span v-else>免费</span>--}}
                            {{--</a>--}}
                        </p>
                    </div>
                    <button class="box-btn" @click=" window.location.href = '{{ route('home.goods.goodsDetails') }}?goodsId='+item.goods.id+'&type='+item.goods.type">
                        查看详情
                    </button>
                    </div>
                </div>
                <!-- 活动 -->
                <div class="footprint_activity footchoose" v-if="item.type==4">
                    <el-checkbox v-if="del" v-model="item.check"></el-checkbox>
                    <div>
                    <img :src="item.act.thumb" class="img">
                    <div class="box">
                        <p class="footprint_title">
                            <span class="footprint_name">@{{item.act.title}}
                            </span>
                            <span class="browseTime"> 浏览于<span>
                                    @{{item.created_at}}
                                </span></span>
                        </p>
                        <p class="footprint_activityMes">
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/monyred.png')}}">--}}
                                <span style="margin-right: 3px;color: red;">价格</span>
                                    <span style="color: red;">@{{item.act.cost}}</span>
                                    <span style="padding: 0 2px;background: #ffa531;margin-left: 3px;border-radius: 2px;color: #fff; " v-if="item.act.act_state!='报名结束'">报名中</span>
                                    <span style="padding: 0 2px;background: #ccc;margin-left: 3px;border-radius: 2px;color: #fff; " v-else>报名结束</span>
                                </span>
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/child.png')}}">--}}
                                <span style="margin-right: 3px;">已报名</span>
                                    @{{item.act.number}}
                                </span>
                            <span>
                                    {{--<img src="{{URL::asset('./img/icon/timeyellow.png')}}">--}}
                                <span style="margin-right: 3px;">活动时间</span>
                                    @{{item.act.start_at}}
                                </span>
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                {{--@{{item.act.view}}--}}
                            {{--</span>--}}
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/child.png')}}">--}}
                                {{--@{{item.act.number}}--}}
                            {{--</span>--}}
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/monyred.png')}}">--}}
                                {{--@{{item.act.cost}}--}}
                            {{--</span>--}}
                            {{--<span>--}}
                                {{--<img src="{{URL::asset('./img/icon/timeyellow.png')}}">--}}
                                {{--@{{item.act.start_at}}--}}
                            {{--</span>--}}
                        </p>
                    </div>
                    <button class="box-btn" @click=" window.location.href = '{{ route('home.activity.actDetails') }}?cateId='+item.act.id">
                        查看详情
                    </button>
                    </div>
                </div>
                <!-- 文档 -->
                <div class="footprint_word" v-if="item.type==5">
                  <el-checkbox v-if="del" v-model="item.check"></el-checkbox>
                  <div>
                  <img :src="item.word.thumb" class="img">
                      <div class="box">
                          <p class="footprint_title">
                              <span class="footprint_name">@{{item.word.title}}
                              </span>
                              <span class="browseTime"> 浏览于<span>
                                      @{{item.created_at}}
                                  </span></span>
                          </p>
                          <p class="footprint_wordMes footprint_activityMes" style="display: flex;">
                              <span>
                                  {{--<img src="{{URL::asset('./img/icon/storeListEye.png')}}">--}}
                                  <span style="margin-right: 3px;">浏览</span>
                                  @{{item.word.view}}
                              </span>
                              <span>
                                  {{--<img src="{{URL::asset('./img/icon/download.png')}}">--}}
                                  <span style="margin-right: 3px;">下载</span>
                                  @{{item.word.download}}
                              </span>
                              {{--<span>--}}
                                  {{--<img src="{{URL::asset('./img/icon/time.png')}}">--}}
                                  {{--@{{item.word.created_at}}--}}
                              {{--</span>--}}
                              <span>
                                  <span style="margin-right: 3px;">格式</span>
                                    <span v-if="item.word.format=='doc'">doc</span>
                                    <span v-if="item.word.format=='docx'">docx</span>
                                    <span v-if="item.word.format=='ppt'">ppt</span>
                                    <span v-if="item.word.format=='pdf'">pdf</span>
                                    <span v-if="item.word.format=='xlsx'">xlsx</span>
                                    <span v-if="item.word.format=='xls'">xls</span>
                                  {{--<img v-if="item.word.format=='doc' || item.word.format=='docx'" src="{{URL::asset('./img/icon/downWord.png')}}">--}}
                                  {{--<img v-if="item.word.format=='ppt'" src="{{URL::asset('./img/icon/downPPT.png')}}">--}}
                                  {{--<img v-if="item.word.format=='pdf'" src="{{URL::asset('./img/icon/downPdf.png')}}">--}}
                                  {{--<img v-if="item.word.format=='xlsx' || item.word.format=='xls'" src="{{URL::asset('./img/icon/downExel.png')}}">--}}
                              </span>
                          </p>
                      </div>
                      <button class="box-btn" @click=" window.location.href = '{{ route('home.word.wordDetails') }}'">
                          查看详情
                      </button>
                  </div>
                </div>
                <!-- 需求 -->
                <div class="footprint_demand" v-if="item.type==2">
                <el-checkbox v-if="del" v-model="item.check"></el-checkbox>
                    <div>
                    <el-tooltip class="item" effect="dark" :content="item.demand.price+'万'" placement="top-start">
                        <span class="itemMone" :class="{active:!del}">
                            <a>
                                ￥
                            </a>@{{item.demand.price}}万
                        </span>
                    </el-tooltip>
                    <!-- <div class="box" :style="{'padding-left':del ? '16px':'36px'}"> -->
                    <div class="box">
                        <p class="footprint_title">
                            <span class="footprint_name">@{{item.demand.title}}
                                <img src="{{URL::asset('./img/icon/urgent.png')}}">
                            </span>
                            <span class="browseTime"> 浏览于<span>
                                    @{{item.created_at}}
                                </span></span>
                        </p>
                        <p>@{{item.demand.content}}</p>
                        <p class="footprint_demandFooter">
                            <span>
                                <a>
                                    @{{item.demand.number}}
                                </a>
                                竞标

                            </span>
                            <span>
                                <a>
                                    @{{item.demand.created_at}}
                                </a>
                                发布
                            </span>
                            <span>
                                <a>
                                    @{{item.demand.end_at}}
                                </a>
                                后截止
                            </span>
                        </p>
                    </div>
                    <button class="box-btn" @click=" window.location.href = '{{ route('home.demand.demandHRDetails') }}?demandId='+item.demand.id">
                        查看详情
                    </button>
                </div>
                    </div>
            </div>

            <div class="elementPage" style="margin-top: 20px;" v-if="pageCount>0">
                <el-pagination :pager-count="5" @current-change="handleCurrentChange" :current-page.sync="pageNumber" background prev-text="上一页" next-text="下一页" layout="prev, pager, next,jumper" :total="pageCount">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
<style>
    .footprint_wordMes.footprint_activityMes {
        display: grid;
        grid-template-columns: 108px 108px 200px 50px;
        grid-column-gap: 10px;
    }

    .footprintMian>div:last-child {
        border-bottom: 1px solid rgba(204, 204, 204, 1);
    }
</style>
@endsection
@section('compontentScipts')
<script>
    $(() => {
        let hrFootprint = new Vue({
            el: '#hrFootprints',
            data: () => {
                return {
                    pageNumber: 1,
                    pageCount: 0,
                    listData: [],
                    del:false
                }
            },
            created() {
                this.getList();
            },
            mounted() {},
            methods: {
                delSure(){
                  const that = this
                  let ids = []
                  this.listData.map(item=>{
                    if(item.check == true){
                      ids.push(item.id)
                    }
                  })
                  apiAjax("{{ route('home.user.userFootprintDelApi')}}", 'post', {
                    id:ids.join(',')
                  }, (res) => {
                        if (res.code == 0) {
                            this.$message({
                                message: "删除成功",
                                type: 'success'
                            });
                          setTimeout(() => {
                            that.getList();
                            that.del = false;
                          }, 1500);
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                    }, (erro) => {

                    });
                },
                getList() {
                    let data = {
                        page: this.pageNumber
                    }
                    apiAjax("{{ route('home.user.userFootprintApi')}}", 'get', data, (res) => {
                        if (res.code == 0) {
                            this.pageCount = res.data.total;
                            this.listData = res.data.data;

                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                    }, (erro) => {

                    });
                },
                handleCurrentChange(val) {
                    this.pageNumber = val;
                    this.getList();
                },
            }
        })
    })
</script>
@endsection